using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace GardeningSkeleton.Platform.SkillSpace
{
    public class CircleSkillSelector : ISkillSelector
    {
        public HashSet<Transform> SelectTarget(SkillData data, Transform skillTF)
        {
            HashSet<Transform> taragets = new();
            Collider2D[] colliders = Physics2D.OverlapCircleAll(skillTF.position, data.range, data.attackTargetLayers);

            for (int i = 0; i < colliders.Length; i++)
            {
                taragets.Add(colliders[i].transform);
            }

            if (taragets.Count == 0)
            {
                // Debug.Log("没有敌人");
                return taragets;
            }
            else
            {
                for (int i = 0; i < taragets.Count; i++)
                {
                    // Debug.Log("敌人" + res[i].name);
                }
                return taragets;
            }
            // return res;
        }
    }
}